﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using JustinAngel.Neurons.Framework;

namespace JustinAngel.Neurons
{
    public class IAppNetworkChecker : IAppService
    {

        [Dependency]
        public INetworkStatusProvider NetworkStatusProvider { get; set; }


        [Dependency]
        public IDialogService DialogService { get; set; }

        public void StartService()
        {
            if (!NetworkStatusProvider.IsConnected)
            {
                DialogService.ShowMessageBox("You are not connected via 3G or WiFi. Please open the app back up again when you're back online.",
                             "DON'T PANIC!",
                             MessageBoxButton.OK);
                throw new ApplicationExitException();
            }
            if (NetworkStatusProvider.IsConnectedToZune)
            {
                DialogService.ShowMessageBox("Windows Phone 7 cannot play videos while connected to a computer running Zune. Either disconnect your Windows Phone 7 from your computer, or close down Zune. Then open this app back up again.",
                             "Close down Zune!",
                             MessageBoxButton.OK);
                throw new ApplicationExitException();
            }
        }


        public void StopService()
        {
        }
    }
}
